<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="client.RoomClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>房间列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <script language="JavaScript" type="">
  function create()//用户创建房间
  {
    document.getElementById("createNewRoom").style.display="block";
  }
  </script>
  <body>
  <br>
  <br><center>
    <div>
    <% 
    //String username=(String)session.getAttribute("username");
    RoomClient rc= new RoomClient();
    Vector<String> roomlist=rc.getAllRooms();
      for(int i=0;i<roomlist.size();i++)
      {
     %>
     <form  action="SelectRoomServlet" method="post">
     <input type="radio" name="roomname" value=<%=roomlist.get(i) %>>
      <%=roomlist.get(i) %>
      <%if((i+1)%2==0){%>
           <br>
     <%} %>
     <%} %>
     <br>
     <input type="submit" value="选择房间">
     <input type="button" name="createRoom" value="创建房间" onclick="create()" >
     </form>
    </div>
   <div id="createNewRoom" style="display:none">
        <form action="CreateRoomServlet" method="post">
             房间名称:<input type="text" name="newroom">
             <input type="submit" value="创建房间">
        </form>
   </div>
   </center>
  </body>
</html>
